var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function () {
        var t = function (e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function (e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })();
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("fsm"),
    a = t("telepoleIdle"),
    i = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.max = 85), e;
        }
        return (
            n(e, t),
            (e.prototype.onEnter = function () {
                var t = this.e;
                (this.startX = t.x),
                    (this.startY = t.y),
                    (this.context.telepoleArea.active = !0),
                    this.context.telepoleArea.setPosition(this.startX, this.startY),
                    this.context.telepole.setPosition(0, 0),
                    cc.sys.os == cc.sys.OS_WINDOWS && (this.context.telepoleArea.opacity = 0);
            }),
            (e.prototype.onTouchMove = function (t) {
                var e = t.x - this.startX,
                    o = t.y - this.startY,
                    n = Math.atan2(o, e),
                    r = Math.cos(n),
                    a = Math.sin(n);
                e / r > this.max && ((e = this.max * r), (o = this.max * a)),
                    this.context.telepole.setPosition(e, o),
                    (this.context.v2.x = r),
                    (this.context.v2.y = a),
                    this.context.callHandle();
            }),
            (e.prototype.isMove = function () {
                return !0;
            }),
            (e.prototype.onTouchEnd = function () {
                r.changeState(this.context, a.default),
                    this.context.callHandle(!1),
                    (this.context.telepoleArea.active = !1);
            }),
            e
        );
    })(t("telepoleState").default);
o.default = i;
